<%@ page language="java"
	import="java.util.*,bookstore.database.pojo.*,bookstore.tools.*"
	pageEncoding="utf-8"%>
<%
	List<Book> books = (List<Book>) request.getSession().getAttribute(
			"indexBooks");
	String curpage = (String) request.getAttribute("curpage");

	int pageNow = 1;
	if (curpage != null) {
		pageNow = Integer.parseInt(curpage);
	}

	int pageNum = Tools.getPageSize("全部分类");

	if (books == null) {
		books = Tools.getBooks("全部分类");
	}
%>
<table width="100%" border="0">
	<tr>
		<td width="2%" rowspan="7" bgcolor="#66CCCC">
			<div align="center"></div>
			<div align="center"></div>
			<div align="center"></div>
			<div align="center"></div>
			<div align="center"></div>
			<div align="center"></div>
			<div align="center"></div>
		</td>
		<td colspan="4">
			<div align="center">
				<img src="img/goodslist.jpg" width="213" height="34" />
			</div>
		</td>
		<td width="2%" rowspan="7" bgcolor="#66CCCC">
			&nbsp;
		</td>
	</tr>
	<%
		int time = 0;
		for (int i = 0; i < 2; i++) {
	%><tr>
		<%
			for (int j = 0; j < 4; j++) {

					String picth = "";
					String name = "";
					String path = "";
					int flag = 0;
					if (time >= books.size()) {
						name = "暂无售书信息";
						picth = "image/none.jpg";
					} else {
						flag = 1;
						Book book = books.get(time);
						picth = book.getImage().getImagePath();
						name = book.getBname();
						String isbn = book.getIsbn();
						path = "bookDetail.do?isbn=" + isbn;
						time++;
					}
		%>
		<td width="24%">
			<div align="center">
				<img src=<%=picth%> width="150" height="150" />
			</div>
			<div align="center">
				<%
					if (flag == 0) {
				%>
				<%=name%>
				<%
					} else {
				%>
				<a href=<%=path%>><%=name%> </a>
				<%
					}
				%>
			</div>
		</td>
		<%
			}
		%>
	</tr>
	<%
		//判断是否第一大行结束
			if (i == 0) {
	%>
	<tr>
		<td colspan="4" bgcolor="#33FF99">
			&nbsp;
		</td>
	</tr>
	<%
		}
		}
	%>
	<tr>
		<td colspan="4">
			<div align="center">
				<%
					for (int i = 1; i <= pageNum; i++) {
				%>
				<a href="searchBook.do?curpage=<%=i%>">【<%=i%>】</a>
				<%
					}
				%>
			</div>
		</td>
	</tr>
</table>
